1. Field of the Invention
The present invention relates to methods and apparatus for improving data integrity for small computer system interface (SCSI) devices.
2. Description of the Related Art
A small computer system interface (SCSI) is a well known and widely used type of interface for computer and data storage devices. A SCSI is generally used to couple a computer system to a device or to couple devices together for communications. Communications are provided between the computer system and the device or between devices through a SCSI interface using a SCSI protocol. SCSI communication generally works very well and is commercially popular. However, a particular data integrity problem with the SCSI protocol has been found when a SCSI “initiator” device is assigned with the same SCSI ID as an SCSI “target” device. This problem will be described in detail with respect to FIGS. 1 and 2.
FIG. 1 is an illustrative representation of a SCSI initiator device 102 and a plurality of SCSI target devices 104. SCSI initiator device 102 and the plurality of SCSI target devices 104 are coupled together for communication via a SCSI bus 112. SCSI initiator device 102 may be a computer or server and SCSI target devices 104 may be hard disk drives, for example. In this example, there are three (3) SCSI target devices 104 which include SCSI target devices 106, 108, and 110. Each SCSI device 102, 106, 108, and 110 is assigned a SCSI ID. In this example, SCSI initiator device 102 is assigned SCSI ID=3, SCSI target device 106 is assigned SCSI ID=1, SCSI target device 108 is assigned SCSI ID=2, and SCSI target device 110 is assigned SCSI ID=3. Note that SCSI initiator device 102 is assigned with the same SCSI ID as SCSI target device 110 (i.e. SCSI ID=3).
If SCSI initiator device 102 selects SCSI target device 108, for example, SCSI target device 110 will undesirably respond to the selection intended for SCSI target device 108. When this occurs, there is no conventional mechanism which prevents the wrong target (e.g. SCSI target device 110) from taking control of SCSI bus 112 and completing the SCSI protocol which includes Command, Data, and Status phases. If the SCSI command intended for SCSI target device 108 is a WRITE command (e.g. SCSI opcodes 0x0A, 0x2A, 0x2E, 0x3F, 0x41), data on the media of SCSI target device 110 is corrupted with data intended to be written at SCSI target device 108. If the SCSI command intended for SCSI target device 108 is a READ command (SCSI opcodes 0x08, 0x28, 0x3E), data from SCSI target device 110 would be returned to SCSI initiator device 102. In both cases, data integrity has been compromised. Even other SCSI commands will compromise data integrity with this scenario.
FIG. 2 is a flowchart which describes the data integrity problem in further detail. FIGS. 1 and 2 will be referred to in combination in the following description. Beginning at a start block 202 of FIG. 2, SCSI initiator device 102 having SCSI ID=3 selects SCSI target device 108 having SCSI=2 on SCSI bus 112 (step 204 of FIG. 2). In response, SCSI target device 110 having SCSI=3 detects its own SCSI ID on SCSI bus 112 and responds to the selection (step 206 of FIG. 2). In effect, SCSI target device 110 “thinks” it has been selected by SCSI initiator device 102. SCSI target device 110 therefore takes control over SCSI bus 112 and proceeds to the next bus phase(s) (step 208 of FIG. 2). Next, SCSI initiator device 102 transmits a WRITE command on SCSI bus 112 (step 210). In response, SCSI target device 110 completes “Message Out” and “Command” phases for the write and disconnects from SCSI bus 112 (step 214 of FIG. 2). SCSI target device 110 then prepares its buffers, reconnects to SCSI bus 112, and selects SCSI target device 108 having SCSI ID=2 (step 216 of FIG. 2). In response, SCSI initiator device 110 having SCSI ID=3 detects its own SCSI ID on SCSI bus 112, thinking that SCSI target device 110 has reselected it, and responds to the reselection (step 218 of FIG. 2). SCSI target device 110 is now connected to SCSI initiator device 102. SCSI target device 110 then requests “Data-Out” for the WRITE command (step 220 of FIG. 2). In response, SCSI initiator device 102 writes data to the media (e.g. a disk) at SCSI target device 110 (step 222 of FIG. 2). After completion, SCSI target device 110 responds with a “Good Status” indication to SCSI initiator device 110 (step 226 of FIG. 2) and Command Complete (step 228 of FIG. 2). As apparent, SCSI target device 110 has been undesirably corrupted with data not intended to be written to it.
Accordingly, there is an existing need to overcome these and other deficiencies of the prior art.